home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_asm
/
testsys
/
testsys.asm
next >
Wrap
Assembly Source File
|
1987-04-08
|
4KB
|
146 lines
CODE SEGMENT BYTE PUBLIC
ASSUME CS:CODE, DS:CODE, ES:CODE
ORG 100H
CR EQU 13
LF EQU 10
BEGIN PROC
MOV DX,OFFSET NOTICE
MOV AH,09H
INT 21H
MOV DX, 0H
MOV BX, 81H
NEXT:
MOV DL,BYTE PTR CS:[BX]
INC BX
CMP DL,20H
JE NEXT
MOV AL,BYTE PTR CS:[BX]
CMP AL,0DH
JE DONE
PERROR:
MOV DX,OFFSET BAD ;Illegal Parameter Specified
MOV AH,09H
INT 21H
MOV AL,2 ; Errorlevel 2 for Parameter Error
JMP QUIT
DONE:
CMP DL, 30H
JL PERROR
CMP DL, 39H
JG PERROR
SUB DL, 30H
MOV AH,62H ; Check Available Memory
INT 21H ; Get Current PSP
MOV CL,12
SHR BX,CL ; Get us a single digit.
CMP BX,DX ; Indicates # of 64k blocks that are in use.
JG REBOOT ; If greater than 2 used then reboot ( < 448k )
MOV AH,2AH ; Check Current Date
INT 21H
CMP CX,1980
JZ ERROR
MOV AL,00H
JMP QUIT
ERROR:
MOV AL,01H
QUIT:
MOV AH,4CH
INT 21H
REBOOT:
MOV SI,0080H ;Is DOS doing something now?
MOV CH,00H
MOV CL,[SI]
JCXZ GET_READY ;No, so go reboot the machine.
LOOP1:
INC SI
MOV AL,[SI]
CMP AL,2FH
JZ SKIP1
LOOP LOOP1
JMP GET_READY
SKIP1:
MOV AL,[SI+01]
CMP AL,6CH
JZ SKIP2
CMP AL,4CH
JZ SKIP2
CMP AL,73H
JZ SKIP3
CMP AL,53H
JZ SKIP3
GET_READY :
MOV AX,1234H
JMP SKIP4
SKIP2:
MOV AX,0000H
MOV AL,0CH
MOV DX,03F2H ;Address of Floppy Controller Port
OUT DX,AL
SKIP4:
MOV BX,0040H
MOV ES,BX
MOV ES:[0072H],AX
IT DB 0EAH, 00H, 00H, 0FFH, 0FFH ; JMP to reboot routine
SKIP3:
MOV AX,0000 ;These instructions ready things for a
MOV ES,AX ; reboot using INT 19
MOV BX,0F000H
CLI
MOV DI,0024H
MOV AX,0E987H
CALL SUB
MOV DI,0058H
MOV AX,0E82EH
CALL SUB
MOV DI,041AH
PUSH BX
MOV AX,001EH
MOV BX,AX
CALL SUB
POP BX
MOV DI,0040H
MOV AX,0F065H
CALL SUB
MOV DI,005CH
MOV AX,0EFD2H
CALL SUB
MOV DI,0070H
MOV AX,0FF53H
CALL SUB
MOV AX,0000H
MOV DI,0180H
MOV CX,0010H
REPZ STOSW
STI
INT 19H
SUB:
MOV ES:[DI],AX
MOV ES:[DI+02],BX
RET
NOTICE DB 'TESTSYS Version 1.00 - (C)copyright April 1987, Christopher D. Orr$'
BAD DB CR,LF,'*** ERROR *** Syntax: TESTSYS {#} where # is from 0 to 9. Each',CR,LF
DB ' number indicates a bank of 64k. (e.g. 1 is less than 128k)',CR,LF
DB CR,LF,'Purpose:',CR,LF
DB ' Will reboot system if free memory less than that specified.',CR,LF
DB ' Sets Errorlevel=1 if year=1980.$'
BEGIN ENDP
CODE ENDS
END BEGIN